package com.day1013.morning;
//  模拟病人叫号
public class MainTextHospital {
    public static void main(String[] args) {
        Thread main = new Thread();//  主线程
        HospitalThread hospitalThread = new HospitalThread(); //  子线程
        main.setPriority(1);
        hospitalThread.setPriority(10);
        hospitalThread.start();
        for (int i = 0; i < 50; i++) {
            System.out.println("普通号病人" + (i+1) + "在看病！");
            try {
                Thread.sleep(500);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            if ((i+1) % 10 == 0){
                try {
                    hospitalThread.join();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
